from django.shortcuts import render

# Create your views here.
from django.views import View
from rest_framework.viewsets import ModelViewSet

from apps.main.models import Movie
from apps.main.serializer import IndexSer
# from apps.utils.apschedulers import doubanspider
from apps.utils.doubanPagenations import DoubanPagination

# from apscheduler.schedulers.background import BackgroundScheduler
# from django_apscheduler.jobstores import register_job,register_events,DjangoJobStore

# aps=BackgroundScheduler()
# aps.add_jobstore(DjangoJobStore(),'default')

class IndexView(ModelViewSet):
    serializer_class = IndexSer
    queryset = Movie.objects.all()
    pagination_class = DoubanPagination

class IndexView2(View):
    def get(self,request):

        data=Movie.objects.filter(id=18)
        content={}
        for item in data:
            content['img_url']=item.img_url
            content['href_url']=item.href_url
        return render(request,'index.html',context=content)

class IndexSearchView(View):
    def get(self,request):
        return render(request,'index1.html')